<template>
    <div class="printOrder-data" >
        <table class="teacher-teacherinformationdetail">
            <tbody>
                <tr>
                    <td width="15%" height="30">身份证号</td>
                    <td id="ID" width="23%">{{detailed.idcard}}</td>
                    <td width="14%">姓名</td>
                    <td width="18%" v-if="detailed.teacher_name !=null">{{detailed.teacher_name.zh?detailed.teacher_name.zh:detailed.teacher_name.mn}}</td>

                    <td width="15%" rowspan="5" style="text-align:center;">个人照片</td>
                    <td width="15%" rowspan="5" style="text-align:center;"><img :src="detailed.imgphotos" width="150" height="180"></td>
                </tr>
                <tr >
                    <td height="30">性别</td>
                    <td v-if="detailed.gender !=null">{{detailed.gender.zh?detailed.gender.zh:detailed.gender.mn}}</td>
                    <td v-else></td>
                    <td>民族</td>
                    <td v-if="detailed.nation !=null">{{detailed.nation.zh?detailed.nation.zh:detailed.nation.mn}}</td>
                    <td v-else></td>
                </tr>
                <tr>
                    <td>出生年月</td>
                    <td>{{detailed.birthday}}</td>
                    <td>国籍</td>
                    <td v-if="detailed.nationality !=null">{{detailed.nationality.zh?detailed.nationality.zh:detailed.nationality.mn}}</td>
                    <td v-else></td>
                </tr>
                <tr>
                    <td>政治面貌</td>
                    <td v-if="detailed.politicaltype !=null">{{detailed.politicaltype.zh?detailed.politicaltype.zh:detailed.politicaltype.mn}}</td>
                    <td v-else></td>
                    <td>联系电话</td>
                    <td id="telNumber">{{detailed.telnumber}}</td>
                </tr>
                <tr>
                    <td>电子邮箱</td>
                    <td>{{detailed.email}}</td>
                    <td>在岗状态</td>
                    <td v-if="detailed.workstatus !=null">{{detailed.workstatus.zh?detailed.workstatus.zh:detailed.workstatus.mn}}</td>
                    <td v-else></td>
                </tr>
                <tr>
                    <td>最高学历</td>
                    <td v-if="detailed.education !=null">{{detailed.education.zh?detailed.education.zh:detailed.education.mn}}</td>
                    <td v-else></td>
                    <td>最高学位</td>
                    <td v-if="detailed.degree !=null">{{detailed.degree.zh?detailed.degree.zh:detailed.degree.mn}}</td>
                    <td v-else></td>
                    <td>是否硕导</td>
                    <td v-if="detailed.mastersupervisor !=null">{{detailed.mastersupervisor.zh?detailed.mastersupervisor.zh:detailed.mastersupervisor.mn}}
                    </td>
                    <td v-else></td>
                </tr>
                <tr>
                    <td height="30">人才类型</td>
                    <td v-if="detailed.type !=null">{{detailed.type.zh?detailed.type.zh:detailed.type.mn}}</td>
                    <td v-else></td>
                    <td>参加工作时间</td>
                    <td>{{detailed.workdate}}</td>
                    <td>是否博导</td>
                    <td v-if="detailed.teach !=null">{{detailed.teach.zh?detailed.teach.zh:detailed.teach.mn}}</td>
                    <td v-else></td>
                </tr>
                </tr>
                <tr>
                    <td height="30">籍贯</td>
                    <td ><a v-if="detailed.nativeprovince !=null">{{detailed.nativeprovince.zh}}</a><a v-if="detailed.nativecity !=null">{{detailed.nativecity.zh}}</a><a v-if="detailed.nativecounty !=null">{{detailed.nativecounty.zh}}</a></td>
                    <td>出生地</td>
                    <td colspan="3"><a v-if="detailed.birthprovince !=null">{{detailed.birthprovince.zh}}</a><a v-if="detailed.birthcity !=null">{{detailed.birthcity.zh}}</a><a v-if="detailed.birthcounty !=null">{{detailed.birthcounty.zh}}</a></td>
                </tr>
                <tr>
                    <td height="30">现住址</td>
                    <td><a v-if="detailed.cmbProvince3 !=null">{{detailed.cmbProvince3.zh}}</a><a v-if="detailed.cmbcity3 !=null">{{detailed.cmbcity3.zh}}</a><a v-if="detailed.cmbcounty3 !=null">{{detailed.cmbcounty3.zh}}</a></td>
                    <td>户籍所在地</td>
                    <td colspan="3"><a v-if="detailed.cmbProvince2 !=null">{{detailed.cmbProvince2.zh}}</a><a v-if="detailed.cmbcity2 !=null">{{detailed.cmbcity2.zh}}</a><a v-if="detailed.cmbcounty2 !=null">{{detailed.cmbcounty2.zh}}</a></td>
                </tr>
                <tr>
                    <td height="30">人才类别<br> (按六支队伍分)
                    </td>
                    <td colspan="5">

                        <CheckboxGroup v-model="sixGroup">

                            <Checkbox v-for="(val,index) in telentcategory.talentcategory_six" :label="val.dictionary_name.zh?val.dictionary_name.zh:val.dictionary_name.mn" :key="index" disabled="">
                            </Checkbox>
                        </CheckboxGroup>
                        </label>
                    </td>
                </tr>
                <tr>
                    <td height="30">人才类别<br> (按九支队伍分)
                    </td>
                    <td colspan="5">
                        <CheckboxGroup v-model="checkAllGroup">
                            <Checkbox v-for="(val,index) in telentcategory.talentcategory_nine" :label="val.dictionary_name.zh?val.dictionary_name.zh:val.dictionary_name.mn" :key="index" disabled="">
                            </Checkbox>
                        </CheckboxGroup>
                    </td>
                </tr>
            </tbody>
            <Spin size="large" fix v-if="spinShow"></Spin>
        </table>
        <Collapse v-model="value1">
            <Panel name="TechnicalQualifications">
                专技资格
                <p slot="content">
                    <technical-qualifications :teacher_id="teacher_id" :user_id="user_id" :status="status"></technical-qualifications>
                </p>
            </Panel>
            <Panel name="JobQualification">
                职(执)业资格
                <p slot="content">
                    <job-qualification :teacher_id="teacher_id" :user_id="user_id" :status="status"></job-qualification>
                </p>
            </Panel>
            <Panel name="WorkExperience">
                工作经历
                <p slot="content">
                    <work-experience :teacher_id="teacher_id" :user_id="user_id" :status="status"></work-experience>
                </p>
            </Panel>
            <Panel name="Awards">
                获奖情况
                <p slot="content">
                    <awards :teacher_id="teacher_id" :user_id="user_id" :status="status"></awards>
                </p>
            </Panel>
            <Panel name="ForeignLanguage">
                外语
                <p slot="content">
                    <foreign-language :teacher_id="teacher_id" :user_id="user_id" :status="status"></foreign-language>
                </p>
            </Panel>
            <Panel name="TrainingSituation">
                培训情况
                <p slot="content">
                    <training-situation :teacher_id="teacher_id" :user_id="user_id" :status="status"></training-situation>
                </p>
            </Panel>
            <Panel name="Paper">
                论文
                <p slot="content">
                    <paper :teacher_id="teacher_id" :user_id="user_id" :status="status"></paper>
                </p>
            </Panel>
            <Panel name="Patents">
                获得授权专利
                <p slot="content">
                    <patents :teacher_id="teacher_id" :user_id="user_id" :status="status"></patents>
                </p>
            </Panel>
            <Panel name="Translation">
                论著和译著
                <p slot="content">
                    <translation :teacher_id="teacher_id" :user_id="user_id" :status="status"></translation>
                </p>
            </Panel>
            <Panel name="ProjectTopic">
                承担课题项目
                <p slot="content">
                    <project-topic :teacher_id="teacher_id" :user_id="user_id" :status="status"></project-topic>
                </p>
            </Panel>
            <Panel name="AcademicGroups">
                学术团体任职情况
                <p slot="content">
                    <academic-groups :teacher_id="teacher_id" :user_id="user_id" :status="status"></academic-groups>
                </p>
            </Panel>
            <Panel name="PartTime">
                兼职
                <p slot="content">
                    <part-time :teacher_id="teacher_id" :user_id="user_id" :status="status"></part-time>
                </p>
            </Panel>
            <Panel name="StudyAbroad">
                留学情况
                <p slot="content">
                    <study-abroad :teacher_id="teacher_id" :user_id="user_id" :status="status"></study-abroad>
                </p>
            </Panel>
            <Panel name="Funding">
                获得资助情况
                <p slot="content">
                    <funding :teacher_id="teacher_id" :user_id="user_id" :status="status"></funding>
                </p>
            </Panel>
            <Panel name="Performance">
                展出和表演
                <p slot="content">
                    <performance :teacher_id="teacher_id" :user_id="user_id" :status="status"></performance>
                </p>
            </Panel>
            <Panel name="TeacherHonor">
                荣誉称号
                <p slot="content">
                    <teacher-honor :teacher_id="teacher_id" :user_id="user_id" :status="status"></teacher-honor>
                </p>
            </Panel>
            <Panel name="LearningExperience">
                学习经历
                <p slot="content">
                    <learning-experience :teacher_id="teacher_id" :user_id="user_id" :status="status"></learning-experience>
                    <br/>
                    <Collapse accordion>
                        <Panel name="LearningExperiencePostdoctoral">
                            博士后人员
                            <p slot="content">
                                <learning-experience-postdoctoral :teacher_id="teacher_id" :user_id="user_id" :status="status"></learning-experience-postdoctoral>
                            </p>
                        </Panel>
                    </Collapse>
                </p>
            </Panel>
            <Panel name="TeamBuilding">
                团队建设
                <p slot="content">
                    <team-building :teacher_id="teacher_id" :user_id="user_id" :status="status"></team-building>
                </p>
            </Panel>
            <Panel name="PhD">
                博导
                <p slot="content">
                    <ph-d :teacher_id="teacher_id" :user_id="user_id" :status="status"></ph-d>
                </p>
            </Panel>
            <Panel name="CurrentUnit">
                现单位情况
                <p slot="content">
                    <current-unit :teacher_id="teacher_id" :user_id="user_id" :status="status"></current-unit>
                </p>
            </Panel>
            <Panel name="TechnicalWorkExperience">
                专技工作经历
                <p slot="content">
                    <technical-work-experience :teacher_id="teacher_id" :user_id="user_id" :status="status"></technical-work-experience>
                </p>
            </Panel>
            <Panel name="PassportManagement">
                护照管理
                <p slot="content">
                    <passport-management :teacher_id="teacher_id" :user_id="user_id" :status="status"></passport-management>
                </p>
            </Panel>
        </Collapse>
    </div>
</template>

<script>
    export default {
        props: {
            status: {
                type: [Boolean],
                default: false
            },
            printstatus: {
                type: [Boolean],
                default: false
            },
            teacher_id: {
                type: [Boolean,String,Number],
                default: false
            },
            user_id: {
                type: [Boolean,String,Number],
                default: false
            }
        },
        components: {
            JobQualification: resolve => {require(['./JobQualification/JobQualification.vue'], resolve);},
            TechnicalQualifications: resolve => {require(['./TechnicalQualifications/TechnicalQualifications.vue'], resolve);},
            WorkExperience: resolve => {require(['./WorkExperience/WorkExperience.vue'], resolve);},
            Awards: resolve => {require(['./Awards/Awards.vue'], resolve);},
            ForeignLanguage: resolve => {require(['./ForeignLanguage/ForeignLanguage.vue'], resolve);},
            TrainingSituation: resolve => {require(['./TrainingSituation/TrainingSituation.vue'], resolve);},
            Paper: resolve => {require(['./Paper/Paper.vue'], resolve);},
            Patents: resolve => {require(['./Patents/Patents.vue'], resolve);},
            Translation: resolve => {require(['./Translation/Translation.vue'], resolve);},
            ProjectTopic: resolve => {require(['./ProjectTopic/ProjectTopic.vue'], resolve);},
            AcademicGroups: resolve => {require(['./AcademicGroups/AcademicGroups.vue'], resolve);},
            PartTime: resolve => {require(['./PartTime/PartTime.vue'], resolve);},
            StudyAbroad: resolve => {require(['./StudyAbroad/StudyAbroad.vue'], resolve);},
            Funding: resolve => {require(['./Funding/Funding.vue'], resolve);},
            Performance: resolve => {require(['./Performance/Performance.vue'], resolve);},
            TeacherHonor: resolve => {require(['./TeacherHonor/TeacherHonor.vue'], resolve);},
            LearningExperience: resolve => {require(['./LearningExperience/LearningExperience.vue'], resolve);},
            LearningExperiencePostdoctoral: resolve => {require(['./LearningExperiencePostdoctoral/LearningExperiencePostdoctoral.vue'], resolve);},
            TeamBuilding: resolve => {require(['./TeamBuilding/TeamBuilding.vue'], resolve);},
            PhD: resolve => {require(['./PhD/PhD.vue'], resolve);},
            CurrentUnit: resolve => {require(['./CurrentUnit/CurrentUnit.vue'], resolve);},
            TechnicalWorkExperience: resolve => {require(['./TechnicalWorkExperience/TechnicalWorkExperience.vue'], resolve);},
            PassportManagement: resolve => {require(['./PassportManagement/PassportManagement.vue'], resolve);},

        },
        data() {
            return {
                detailed: [],
                telentcategory: [],
                checkAllGroup: [],
                sixGroup: [],
                spinShow:false,
                value1: [],


            }
        },
        methods: {

            // ==================================================
            // 打印
            // ==================================================
            printingClick () {
                // 3. 还原：将旧的页面储存起来，当打印完成后返给给页面。
                var oldstr = document.body.innerHTML
                // 1.设置要打印的区域 div的className
                var newstr = document.getElementsByClassName('printOrder-data')[0].innerHTML
                // 2. 复制给body，并执行window.print打印功能
                document.body.innerHTML = newstr
                window.print()
                window.location.reload();
                document.body.innerHTML = oldstr
                return false
            },

        },
        created() {
            this.spinShow=true
            this.$http.get('api/dictionary/v1/dictionary/pidquerys?talentcategory_six&talentcategory_nine')
            .then((response) => {
                this.telentcategory = response.data
            })
            .catch(err => {
                if (err.code && err.code == 422) {
                    this.$Message.error(err.message);
                }
            })

            this.$http.get('api/teacher/v1/teacher/info/' + this.teacher_id).then(val => {
                this.detailed = val.data
                for (let item in val.data.talentcategorysix_nine) {
                    this.checkAllGroup.push(val.data.talentcategorysix_nine[item])
                }
                for (let item in val.data.talentcategorysix_six) {
                    this.sixGroup.push(val.data.talentcategorysix_six[item])
                }
                this.spinShow=false

            }).catch(err => {
                if (err.code && err.code == 422) {
                    this.$Message.error(err.message);
                }
                this.spinShow=false
            })
        },
        watch:{
            'printstatus':{
                handler(){
                    if(this.printstatus==true){
                        this.value1=['JobQualification','TechnicalQualifications','WorkExperience','Awards','ForeignLanguage','TrainingSituation','Paper','Patents','Translation','ProjectTopic','AcademicGroups','PartTime','StudyAbroad','Funding','Performance','TeacherHonor','LearningExperience','LearningExperiencePostdoctoral','TeamBuilding','PhD','CurrentUnit','TechnicalWorkExperience','PassportManagement',]
                        setTimeout(() => {
                            this.printingClick()
                        }, 5000);
                    }

                }
            },
        },

    }
</script>

<style lang="less">
    .teacher-teacherinformationdetail {
        border: 1px solid #e6e6e6;
        border-collapse: separate;
        border-left: 0;
        -webkit-border-radius: 2px;
        -moz-border-radius: 2px;
        border-radius: 2px;
        background-color: transparent;
        border-collapse: collapse;
        border-spacing: 0;
        margin-bottom: 0;
        max-width: 100%;
        width: 100%;
        position: relative;
        tbody {
            tr {
                padding: 6px 8px;
                line-height: 18px;
                text-align: left;
                vertical-align: middle;
                border-top: 1px solid #e6e6e6;
                td {
                    padding: 6px 8px;
                    line-height: 18px;
                    text-align: left;
                    vertical-align: middle;
                    border-top: 1px solid #e6e6e6;
                    height: 25px;
                    border-left: 1px solid #e6e6e6;
                }
            }
        }
        label.ivu-checkbox-wrapper.ivu-checkbox-group-item.ivu-checkbox-wrapper-checked.ivu-checkbox-wrapper-disabled>span.ivu-checkbox.ivu-checkbox-checked.ivu-checkbox-disabled>span.ivu-checkbox-inner {
            border: 1px solid #28a3ef;
            background: #28a3ef;
        }
        label.ivu-checkbox-wrapper.ivu-checkbox-group-item.ivu-checkbox-wrapper-checked.ivu-checkbox-wrapper-disabled>span {
            color: #000;
        }
        label.ivu-checkbox-wrapper.ivu-checkbox-group-item.ivu-checkbox-wrapper-disabled>span {
            color: #999;
        }
        label.ivu-checkbox-wrapper.ivu-checkbox-group-item.ivu-checkbox-wrapper-checked.ivu-checkbox-wrapper-disabled>span.ivu-checkbox.ivu-checkbox-checked.ivu-checkbox-disabled>span.ivu-checkbox-inner>checked {
            content: "\e607";
            color: #28a3ef;
        }
    }
</style>
